package com.bank.backend.boot.server.controller;

import com.bank.backend.boot.base.model.dto.AuditDTO;
import com.bank.backend.boot.base.model.vo.AuditVO;
import com.bank.backend.boot.server.annotation.ResponseResult;
import com.bank.backend.boot.server.service.AuditService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiaowei
 * @since 2025/4/26 22:30
 */
@Slf4j
@Tag(name = "交易审核")
@RestController
@RequestMapping("/audit")
public class AuditController {
    @Resource
    private AuditService auditService;

    @Operation(summary = "插入审核操作")
    @PostMapping("/saveAudit")
    @ResponseResult
    public boolean saveAudit(@RequestBody AuditDTO auditDTO) {
        log.info("auditDTO:{}", auditDTO);
        return auditService.saveAudit(auditDTO);
    }

    @Operation(summary = "获取审核操作（分页）")
    @GetMapping("/queryAuditPage/{current}/{pageSize}")
    @ResponseResult
    public Page<AuditVO> queryAuditPage(@PathVariable("current") int current, @PathVariable("pageSize") int pageSize) {
        return auditService.queryAuditPage(current, pageSize);
    }

}
